package com.jt.blog.service;

import com.jt.blog.model.BlogStatistics;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

/**
 * @author TIM
 * @create 2016-09-27 09
 **/
@CacheConfig(cacheNames = "blogStatistics")
@Service
public class BlogStatisticsServiceImpl extends AbstractBaseService<BlogStatistics> implements BlogStatisticsService {

    @Cacheable(key = "'BS'+#blogId")
    @Override
    public BlogStatistics get(Long blogId) {
        return mapper.selectByPrimaryKey(blogId);
    }

    @CachePut(key = "'BS'+#blogStatistics.blogId")
    @Override
    public BlogStatistics update(BlogStatistics blogStatistics) {
        mapper.updateByPrimaryKeySelective(blogStatistics);
        return blogStatistics;
    }

}
